@import "../ea-ui-base-style.scss";

@mixin carousel-item-arrow {
  &.ea-carousel-item_arrow--left {
    left: 0;
    transform: translate(50%, -50%);
    opacity: 1;
  }

  &.ea-carousel-item_arrow--right {
    right: 0;
    transform: translate(-50%, -50%);
    opacity: 1;
  }
}

.ea-carousel_wrap {
  position: relative;
  overflow: hidden;

  .ea-carousel_content-container {
    position: relative;

    display: flex;

    color: #fff;

    text-align: center;
    height: 300px;
    transition: transform 0.5s;

    ::slotted(ea-carousel-item) {
      flex: 0 0 100%;
      width: 100%;
    }
  }

  .ea-carousel-item_arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;

    width: 1.5rem;
    height: 1.5rem;
    line-height: 1.5;
    font-weight: 800;
    text-align: center;
    border-radius: 50%;
    background-color: rgba(31, 45, 61, 0.11);
    color: #fff;

    cursor: pointer;
    user-select: none;

    transition: background-color 0.3s, transform 0.3s, opacity 0.3s;

    &.ea-carousel-item_arrow--left {
      left: 0;
      transform: translate(-100%, -50%);
    }

    &.ea-carousel-item_arrow--right {
      right: 0;
      transform: translate(100%, -50%);
    }

    &:hover {
      background-color: rgba(31, 45, 61, 0.3);
    }
  }

  .ea-carousel-indicator_wrap {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);

    display: flex;
    flex-direction: row;
    align-items: center;
    cursor: pointer;

    .ea-carousel-item_indicator {
      width: 0.5rem;
      height: 0.5rem;
      border-radius: 50%;
      background-color: rgba(255, 255, 255, 0.4);
      margin: 0.25rem;
      transition: background-color 0.3s;

      &.ea-carousel-item_indicator--active {
        background-color: #fff;
      }
    }
  }

  ::slotted(ea-carousel-item:nth-child(odd)) {
    --odd-bgc: #d3dce6;
  }

  &.hover-trigger {
    &:hover {
      .ea-carousel-item_arrow {
        @include carousel-item-arrow;
      }
    }
  }

  &.always-show-arrow {
    .ea-carousel-item_arrow {
      @include carousel-item-arrow;
    }
  }

  &.ea-carousel--horizontal {
    .ea-carousel_content-container {
      flex-direction: row;
    }
  }

  &.ea-carousel--vertical {
    .ea-carousel_content-container {
      flex-direction: column;
    }

    .ea-carousel-item_arrow {
      display: none;
    }

    .ea-carousel-indicator_wrap {
      left: 100%;
      bottom: 50%;

      flex-direction: column;

      transform: translate(-200%, 50%);
    }
  }
}
